package com.example.demo_test_start.controller;

import com.ddj.hello.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class IndexController {


    @Resource
  private HelloService helloService;

    @ResponseBody
    @GetMapping("/")
    public String index(){
        return "abc";
    }

    @ResponseBody
    @GetMapping("/hello/{name}")
    public String hello(@PathVariable("name") String name){
        return helloService.sayHello(name);
    }


    @ResponseBody
    @GetMapping("/info")
     public String info() {
                 return helloService.helloWorld();
             }
}
